<style scoped>
.page {
  height: calc(100vh - 50px);
  background: #f5f7fc;
  overflow: scroll;
}
.message {
  background: #fff;
  width: 345px;
  margin: 14px auto;
  border-radius: 5px;
  padding: 0 12px 16px;
  box-sizing: border-box;
}
.title {
  font-size: 16px;
  color: #222;
  font-weight: bold;
  line-height: 48px;
}
.content {
  color: #666666;
  font-size: 12px;
  letter-spacing: 0.38px;
  line-height: 17px;
}
.time {
  font-size: 10px;
  color: #999999;
  margin-top: 10px;
}
</style>

<template>
  <div class="page">
    <div class="message" v-for="(item,index) in list" :key="index">
      <div class="title">{{item.title}}</div>
      <div class="content" v-html="item.content">{{item.content}}</div>
      <div class="time">{{item.createtime}}</div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      list: [],
      total: 0
    };
  },
  async mounted() {
    let res = await this.$http(`api/index/message_list`);
    console.log(res);
    this.total = res.data.count;
    this.list = res.data.list;
  }
  // methods: {
  //   async onLoad() {
  //     if (this.size * this.page < this.total) {
  //       let res = await this.$http(`api/index/message_list`, {
  //         params: {
  //           page: this.page,
  //           size: this.size
  //         }
  //       });
  //       this.page++;
  //       this.list.push(...res.data.list);
  //     } else {
  //       window.onscroll = null;
  //     }
  //   }
  // }
};
</script>
